package com.cencat.user.dto;

import jakarta.validation.constraints.*;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;

/**
 * 用户查询DTO
 * @author cencat
 * @since 2024-01-01
 */
@Data
@Schema(description = "用户查询DTO")
public class UserQueryDTO {

    @Schema(description = "用户名（模糊查询）", example = "admin")
    private String username;

    @Schema(description = "真实姓名（模糊查询）", example = "张三")
    private String realName;

    @Email(message = "邮箱格式不正确")
    @Schema(description = "邮箱", example = "admin@cencat.com")
    private String email;

    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    @Schema(description = "手机号", example = "13800138000")
    private String phone;

    @Min(value = 0, message = "性别值不正确")
    @Max(value = 2, message = "性别值不正确")
    @Schema(description = "性别（0-未知，1-男，2-女）", example = "1")
    private Integer gender;

    @Schema(description = "用户状态", example = "ACTIVE")
    private String status;

    @NotNull(message = "租户ID不能为空")
    @Min(value = 1, message = "租户ID必须大于0")
    @Schema(description = "租户ID", example = "1")
    private Long tenantId;

    @Schema(description = "创建时间开始", example = "2024-01-01")
    private String createTimeStart;

    @Schema(description = "创建时间结束", example = "2024-12-31")
    private String createTimeEnd;

    @Min(value = 1, message = "页码必须大于0")
    @Schema(description = "页码", example = "1")
    private Integer pageNum = 1;

    @Min(value = 1, message = "每页大小必须大于0")
    @Max(value = 100, message = "每页大小不能超过100")
    @Schema(description = "每页大小", example = "10")
    private Integer pageSize = 10;

    @Schema(description = "排序字段", example = "createTime")
    private String orderBy = "createTime";

    @Schema(description = "排序方向（ASC/DESC）", example = "DESC")
    private String orderDirection = "DESC";
}